ViewStack

Kind of class:class
Inherits from:UIComponent < MovieClip
Classpath:gfx.controls.ViewStack
File last modified:Tuesday, 29 June 2010, 09:03:27
The CLIK ViewStack displays a single view from a set that is loaded and optionally cached internally. This component can be used for multi-view components such as a TabBox, or Accordion. A ViewStack can also be pointed at another component such as a RadioButton group to automatically change views when the component changes.

Inspectable Properties
A MovieClip that derives from the UILoader component will have the following inspectable properties:
  • visible: Hides the component if set to false.
  • cache: If set to true, loaded views will be cached internally. This saves on processing time to create the views, but requires an immutable ViewStack targetGroup (see below).
  • targetGroup: A name of a valid group object, such as ButtonGroup, that generates ‘change’ events. The current element in the group object must have a data property containing a linkage ID for the view to be loaded and displayed. RadioButtons, for example, have a data property that can be assigned a linkage ID via the Flash Studio Component Inspector.
  • enableInitCallback: If set to true, _global.CLIK_loadCallback() will be fired when a component is loaded and _global.CLIK_unloadCallback will be called when the component is unloaded. These methods receive the instance name, target path, and a reference the component as parameters. _global.CLIK_loadCallback and _global.CLIK_unloadCallback should be overriden from the game engine using GFx FunctionObjects.
States
There are no states for the ViewStack component. Views loaded and displayed by the ViewStack may have its own states.

Events
The ViewStack does not produce any events.
Component metadata:
    InspectableList
    "cache"
    "enableInitCallback"
    "inspectableTargetGroup"
    "visible"

    Summary


    Instance properties
    • cache
      • The default cache mode for views loaded without explicitly defining the cache argument.
    • currentView
      • The currently active, visible view.
    • targetGroup
      • The component or ButtonGroup name to listen to for a "change" event.
    Class methods
    Class methods inherited from UIComponent
    Instance methods
    • show
      • Instantiate a new view based on a linkage.
    • precache
      • Pre-caches a set of views.

    Instance properties

    cache

    cache:Boolean = false
    (read,write)

    The default cache mode for views loaded without explicitly defining the cache argument.

    currentView

    currentView:MovieClip
    (read,write)

    The currently active, visible view.

    targetGroup

    targetGroup:Object
    (read,write)

    The component or ButtonGroup name to listen to for a "change" event. When the targetGroup dispatches a "change" event, the view will be changed using the data property of the targetGroup as the linkage.

    Instance methods

    precache

    function precache (
    linkages:Array) : Void

    Pre-caches a set of views. All the views are set to visible=false. Currently, views with the same linkage can only be created once.
    Parameters:
    linkages:
    An array of linkages to instantiate.

    show

    function show (
    linkage:String, cache:Boolean) : MovieClip

    Instantiate a new view based on a linkage. If the view has been already cached, it will become visible. The currently visible view will be hidden, and destroyed if it is not cached.
    Parameters:
    linkage:
    The linkage ID of the symbol in the library to create.
    cache :
    The cache mode of the view. If the view is already cached, but the cache parameter is false, the view will remain cached.
    Returns:
    • The view that is created or displayed.